<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="帐务明细" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doCancel(){
		window.close();
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location.reload(true);
		}
	}
	function doPurchaseBillShow(id){
		var url="/purchase/PurchaseBillEdit.ihtm?id="+id;
		ShowIframe("采购单",url,1024,500,"refreshWin()",900,600);
	}
	function doAdjustBillShow(id){
		var url="/finance/AdjustBillEdit.ihtm?id="+id;
		ShowIframe("调账单",url,1024,500,"refreshWin()",900,600);
	}
	function doPayBillShow(id){
		var url="/finance/PayBillEdit.ihtm?id="+id;
		ShowIframe("付款单",url,1024,500,"refreshWin()",900,600);
	}
	function doPurchaseBillPrint(id){
		showWin(900,600,"/purchase/PurchaseBillPrint.ihtm?id="+id);
	}
	function doAdjustBillPrint(id){
		showWin(900,600,"/finance/AdjustBillPrint.ihtm?id="+id);
	}
</script>
</head>
<body oncontextmenu="return false" class="sheet" style="text-align:center;">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>帐务明细</h2>
      <p>${est.estName}</p>
    </div>
  </div>
  <div class="sheet-list">
    <div class="search-business">
			<%@include file="../inc/AlertMsg.jsp"%>
			<c:if test="${fn:length(purchaseBillList)==0 && fn:length(cooperBillList)==0 && fn:length(payBillList)==0 && fn:length(adjustBillList)==0}">
					没有帐务明细纪录
			</c:if>
			<c:if test="${fn:length(purchaseBillList)>0}">
		    <div class="table-list">
						<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center" id="itemTbl">
							<tr>
								<th colspan="6"><div align="left">采购单及预付款</div></th>
							</tr>
							<tbody id="itemRowTbl">
							<tr>
								<th width="20%" >单号</th>
								<th width="5%" >进/退</th>
								<th width="15%" >日期</th>
								<th width="20%" >总金额（元）</th>
								<th width="30%" >预付金额（元）</th>
								<th width="10%" >操作</th>
							</tr>
							<c:forEach var="item" items="${purchaseBillList}">
							<tr>
								<td >${item.billCode}</td>
								<td >
									<c:if test="${item.billType=='BUY'}">进</c:if>
									<c:if test="${item.billType=='BACK'}">退</c:if>
								</td>
								<td ><fmt:formatDate value="${item.purchaseDate}" pattern="yyyy-MM-dd"/></td>
								<td >${item.cost}</td>
								<td >${item.imprest}</td>
								<td >
									<a href="javascript:doPurchaseBillShow('${item.id}');">查看</a>
									<a href="javascript:doPurchaseBillPrint('${item.id}');">打印</a>
								</td>
							</tr>
							</c:forEach>
							</tbody>
						</table>
					</div>
		</c:if>
		<div class="blank12"></div>
	
		<c:if test="${fn:length(payBillList)>0}">
		    <div class="table-list">
					<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center" id="itemTbl">
						<tr>
							<th colspan="5"><div align="left">付款</div></th>
						</tr>
						<tbody id="itemRowTbl">
						<tr>
							<th width="20%" >付款单号</th>
							<th width="20%" >付款日期</th>
							<th width="50%" >付款金额（元）</th>
							<th width="10%" >操作</th>
						</tr>
						<c:forEach var="item" items="${payBillList}">
						<tr>
							<td >${item.billCode}</td>
							<td ><fmt:formatDate value="${item.payDate}" pattern="yyyy-MM-dd"/></td>
							<td >${item.cost}</td>
							<td ><a href="javascript:doPayBillShow('${item.id}');">查看</a></td>
						</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
		</c:if>
		<div class="blank12"></div>		
		<c:if test="${fn:length(adjustBillList)>0}">
		    <div class="table-list">
					<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center" id="itemTbl">
						<tr>
							<th colspan="5"><div align="left">调账</div></th>
						</tr>
						<tbody id="itemRowTbl">
						<tr>
							<th width="20%" >调账单号</th>
							<th width="20%" >调账日期</th>
							<th width="20%" >调账金额（元）</th>
							<th width="30%" >调账类型</th>
							<th width="10%" >操作</th>
						</tr>
						<c:forEach var="item" items="${adjustBillList}">
						<tr>
							<td >${item.billCode}</td>
							<td ><fmt:formatDate value="${item.adjustDate}" pattern="yyyy-MM-dd"/></td>
							<td >
								<c:if test="${item.adjustType=='PAY_ABATE' || item.adjustType=='PUR_BACK_ADD'}">${0-item.cost}</c:if>
								<c:if test="${item.adjustType=='PAY_ADD' || item.adjustType=='PUR_BACK_ABATE'}">${item.cost}</c:if>
							</td>
							<td >
								<c:if test="${item.adjustType=='PAY_ADD'}">采购付款金额增加</c:if>
								<c:if test="${item.adjustType=='PAY_ABATE'}">采购付款金额减少</c:if>
								<c:if test="${item.adjustType=='PUR_BACK_ADD'}">采购退货金额增加</c:if>
								<c:if test="${item.adjustType=='PUR_BACK_ABATE'}">采购退货金额减少</c:if>
							</td>
							<td >
								<a href="javascript:doAdjustBillShow('${item.id}');">查看</a>
								<a href="javascript:doAdjustBillPrint('${item.id}');">打印</a>
							</td>
						</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
		</c:if>    
    </div>
  </div>
<div class="blank12"></div>	
</div>
</body>
</html>